/*
 * @Author: 凌宇king
 * @Date: 2022-09-25 09:45:50
 * @LastEditTime: 2022-09-25 13:27:37
 */
const formatOrderInfo = data => {
    //解构出orderType 
    const { orderType, info } = data
    orderKeys = {} //格式化保存info中的key对应的中文,比如expressType对应的中文为 快递类型 
    orderInfo = [] //保存格式化后的info,转为数组 
    switch (orderType) {
        case "快递代取": orderKeys = {
            expressType: '快递类型',
            expressInfo: '取件信息',
            img: '图片',
            mark: '备注',
            arriveTime: '期望送达',
            genderLimit: '性别限制',
            expressNum: '快递数量'
        }
            break;
        case "打印服务": orderKeys = {
            filePath: '打印附件',
            pageNum: '页数',
            mark: '备注信息',
            colorPrint: '是否彩印',
            doublePrint: '是否双面'
        }
            break;
        case "校园跑腿": orderKeys = {
            content: '帮助内容'
        }
            break;
        case "快递代寄": orderKeys = {
            expressInfo: '帮助内容',
            mark: '备注信息'
        }
            break;
        case "租借服务": orderKeys = {
            content: '租界物品',
            rentDuration: '租借时长',
            deliveryTime: '预计交货时间'
        }
            break;
        case "游戏陪玩": orderKeys = {
            platform: '游戏平台',
            playDuration: '游戏时间或盘数',
            mark: '备注',
            gameID: '游戏ID',
        }
            break;
        case "代扔垃圾": orderKeys = {
            rubbishType: '垃圾大小',
            img: '图片',
            mark: '备注信息',
            rubbishNum: '垃圾数量',
        }
            break;
        case "代替服务": orderKeys = {
            content: '帮助内容'
        }
            break;
        case "其他帮助": orderKeys = {
            content: '帮助内容'
        }
            break;
    }
    //遍历info对象，将info中的值及orderKeys中的值存入orderInfo数组
    for (let key in info) {
        orderInfo.push({ key: orderKeys[key], value: info[key] })
    } return orderInfo
}
module.exports = { formatOrderInfo }